/*
 * Copyright (C) 2014 luke.
 * 
 * This file is part of Silvie.
 * 
 * Silvie is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Silvie is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Silvie.  If not, see <http://www.gnu.org/licenses/>.
 */

package silvie.resources.images;

import java.io.File;

/**
 * AbstractImage specialization for Silver RAW images (RAW files and files found
 * in the data/levels/credit directory).
 * 
 * @author luke
 */
public class RAWImage extends AbstractImage {
	private static final int RAW_WIDTH_OFFSET = 4;
	private static final int RAW_HEIGHT_OFFSET = 8;
	private static final int RAW_PALETTE_OFFSET = 44;
	private static final int RAW_PIXELS_OFFSET = 812;

	/**
	 * RAWImage constructor.
	 * 
	 * @param RAWFile the RAW file.
	 */
	public RAWImage(File RAWFile) {
		super(RAWFile);
		super.widthOffset = RAW_WIDTH_OFFSET;
		super.heightOffset = RAW_HEIGHT_OFFSET;
		super.paletteOffset = RAW_PALETTE_OFFSET;
		super.pixelIndicesOffset = RAW_PIXELS_OFFSET;
	}

	@Override
	public void extract() throws Exception {
		super.extract();
		readDimensions();
		readPalette();
		readPixelIndices();
	}
}
